#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'Python使用MySQL'

import pymysql

if __name__ == '__main__':
    try:
        conn = pymysql.connect(
            host='localhost',
            port=3306,
            user='root',
            passwd='root',
            db='cs',
            charset='utf8'
        )
        cursor = conn.cursor()
        cursor.execute('select name from app_files')
        value = cursor.fetchall()
        print(list(map(lambda x: x[0], value)))
    except Exception as e:
        print(e)
    finally:
        cursor.close()
        conn.close()
